<%@ LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'///////////////////////////////////////////////////////////////////////////////
'// 插件应用:    Z-Blog 1.8 Spirit
'// 插件制作:    haphic(http://haphic.esloy.com)
'// 备    注:    DeepEyes 自助修改评论
'// 最后修改：   2009-12-29
'// 最后版本:    0.9.5
'///////////////////////////////////////////////////////////////////////////////
%>
<% Option Explicit %>
<% 'On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<!-- #include file="../../../c_option.asp" -->
<!-- #include file="../../../function/c_function.asp" -->
<!-- #include file="../../../function/c_function_md5.asp" -->
<!-- #include file="../../../function/c_system_lib.asp" -->
<!-- #include file="../../../function/c_system_base.asp" -->
<!-- #include file="../../../function/c_system_plugin.asp" -->
<!-- #include file="../../../function/c_system_event.asp" -->
<!-- #include file="../../../plugin/p_config.asp" -->
<%
Call System_Initialize()

'检查是否启用
If Not LCase(ZC_BLOG_THEME)=LCase("Couple") Then Call ShowError(48) 

Dim strAct
Dim inpID,inpArticle,inpIP,inpAgent
Dim objComment

strAct=Request.QueryString("act")

If strAct="get" Then
	inpID=Request.QueryString("id")
	Call CheckParameter(inpID,"int",0)
	Set objComment=New TComment
		If objComment.LoadInfoByID(inpID) Then
			Response.Write objComment.Content
		Else
			Response.Write "数据载入错误, 该评论并不存在!"
		End If
	Set objComment=Nothing

ElseIf strAct="post" Then

	ShowError_Custom="Call RespondError(id,ZVA_ErrorMsg(id)):Response.End"

	inpID=Request.Form("inpID")
	inpArticle=Request.Form("inpArticle")
	inpIP=Request.ServerVariables("REMOTE_ADDR")
	inpAgent=Request.ServerVariables("HTTP_USER_AGENT")

	Call CheckParameter(inpID,"int",0)
	inpIP=FilterSQL(inpIP)
	inpAgent=FilterSQL(inpAgent)

	If (Len(inpArticle)=0 Or Len(inpArticle)>ZC_CONTENT_MAX) And (BlogUser.Level>2) Then
		Call  ShowError(46)
	End If

	Set objComment=New TComment
		If objComment.LoadInfoByID(inpID) Then

			If BlogUser.Level>2 Then
				'验证有无回复
				If InStr(objComment.Content,"[/REVERT]")>0 Then
					ZVA_ErrorMsg(42)="已存在回复的评论无法被编辑, " & ZVA_ErrorMsg(42) &"!"
					Call  ShowError(42)
					Set objComment=Nothing
				End If
				'验证时间
				If DateDiff("n",objComment.PostTime,Now())>60 Then
					ZVA_ErrorMsg(42)="自原评论提交至今已超一个小时, " & ZVA_ErrorMsg(42) &"!"
					Call  ShowError(42)
					Set objComment=Nothing
				End If
				'验证IP
				If objComment.IP<>inpIP Then
					ZVA_ErrorMsg(42)="IP 与原评论不符, " & ZVA_ErrorMsg(42) &"!"
					Call  ShowError(42)
					Set objComment=Nothing
				End If
				'验证浏览器
				If objComment.Agent<>inpAgent Then
					ZVA_ErrorMsg(42)="浏览器与原评论不符, " & ZVA_ErrorMsg(42) &"!"
					Call  ShowError(42)
					Set objComment=Nothing
				End If

			End If

			objComment.Content=inpArticle

			'接口
			Call Filter_Plugin_PostComment_Core(objComment)

			If objComment.Post Then
				If objComment.log_ID>0 Then
					Call BuildArticle(objComment.log_ID,False,True)
					BlogReBuild_Comments
				Else
					BlogReBuild_GuestComments
				End If
				Call ClearGlobeCache
				Call LoadGlobeCache
				Response.Write objComment.HtmlContent
			End if
		Else
			ZVA_ErrorMsg(3)=ZVA_ErrorMsg(3) & ", 该评论并不存在!"
			Call  ShowError(3)
		End If
	Set objComment=Nothing
Else
	Call  ShowError(3)
End If

Call System_Terminate()

If Err.Number<>0 then
  Call ShowError(0)
End If
%>

